package com.example.demo.huawei;

import java.util.Scanner;

/*
没太明白
 */
public class OD59 {
    private static int m, n, k;
    private static boolean[][] visited;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        m = scanner.nextInt();
        n = scanner.nextInt();
        k = scanner.nextInt();
        visited = new boolean[m][n];
        System.out.println(dfs(0, 0));
    }

    private static int dfs(int x, int y) {
        // 判断坐标是否越界 或者被访问过 或者数位和＞k
        if (x < 0 || y < 0 || x >= m || y >= n || visited[x][y] || sumOfDigits(x) + sumOfDigits(y) > k) {
            // 当前格子不可访问
            return 0;
        }
        visited[x][y] = true;
        return 1 + dfs(x + 1, y) + dfs(x - 1, y) + dfs(x, y + 1) + dfs(x, y - 1);
    }

    private static int sumOfDigits(int n) {
        int sum = 0;
        while (n > 0) {
            int n1 = n % 10;
            sum += n1;
            n = n / 10;
        }
        return sum;
    }
}
